﻿using MySql.Data.MySqlClient;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Web;
using PMSWenLvTing.Model;
using PMSWenLvTing.Utility;
using PMSWenLvTing.Model.JiuDian;

namespace PMSWenLvTing.DAL
{
    public class MainDAL
    {
        DBHelper sqlhelper = new DBHelper();

        /// <summary>
        /// 根据条件获取系统yonghu_jiudian列表
        /// </summary>
        /// <param name="strWhere">查询条件</param>
        public List<yonghu_jiudian> Get_yonghu_jiudian(string strWhere)
        {
            string sql = "SELECT * FROM yonghu_jiudian ";
            if (!string.IsNullOrEmpty(strWhere))
            {
                sql += ("where " + strWhere);
            }
            DataTable dt = sqlhelper.GetDataTable(sql, CommandType.Text, null);
            List<yonghu_jiudian> lis = new List<yonghu_jiudian>();
            if (dt != null)
            {
                foreach (DataRow row in dt.Rows)
                {
                    lis.Add(RowToModelHelper.yonghu_jiudianDataRowToModel(row));
                }
            }
            return lis;
        }

        /// <summary>
        /// 根据条件获取系统yonghu_wenlvting列表
        /// </summary>
        /// <param name="strWhere">查询条件</param>
        public List<yonghu_wenlvting> Get_yonghu_wenlvting(string strWhere)
        {
            string sql = "SELECT * FROM yonghu_wenlvting ";
            if (!string.IsNullOrEmpty(strWhere))
            {
                sql += ("where " + strWhere);
            }
            DataTable dt = sqlhelper.GetDataTable(sql, CommandType.Text, null);
            List<yonghu_wenlvting> lis = new List<yonghu_wenlvting>();
            if (dt != null)
            {
                foreach (DataRow row in dt.Rows)
                {
                    lis.Add(RowToModelHelper.yonghu_wenlvtingDataRowToModel(row));
                }
            }
            return lis;
        }

        /// <summary>
        /// 根据条件获取系统baobiao_fabu列表
        /// </summary>
        /// <param name="strWhere">查询条件</param>
        public List<baobiao_fabu> Get_baobiao_fabu(string strWhere)
        {
            string sql = "SELECT * FROM baobiao_fabu ";
            if (!string.IsNullOrEmpty(strWhere))
            {
                sql += ("where " + strWhere);
            }
            DataTable dt = sqlhelper.GetDataTable(sql, CommandType.Text, null);
            List<baobiao_fabu> lis = new List<baobiao_fabu>();
            if (dt != null)
            {
                foreach (DataRow row in dt.Rows)
                {
                    lis.Add(RowToModelHelper.baobiao_fabuDataRowToModel(row));
                }
            }
            return lis;
        }

        /// <summary>
        /// 根据条件获取系统baobiao_zhuangtai列表
        /// </summary>
        /// <param name="strWhere">查询条件</param>
        public List<baobiao_zhuangtai> Get_baobiao_zhuangtai(string strWhere)
        {
            string sql = "SELECT * FROM baobiao_zhuangtai ";
            if (!string.IsNullOrEmpty(strWhere))
            {
                sql += ("where " + strWhere);
            }
            DataTable dt = sqlhelper.GetDataTable(sql, CommandType.Text, null);
            List<baobiao_zhuangtai> lis = new List<baobiao_zhuangtai>();
            if (dt != null)
            {
                foreach (DataRow row in dt.Rows)
                {
                    lis.Add(RowToModelHelper.baobiao_zhuangtaiDataRowToModel(row));
                }
            }
            return lis;
        }

        /// <summary>
        /// 根据条件获取系统jiudian列表
        /// </summary>
        /// <param name="strWhere">查询条件</param>
        public List<jiudian> Get_jiudian(string strWhere)
        {
            string sql = "SELECT * FROM jiudian ";
            if (!string.IsNullOrEmpty(strWhere))
            {
                sql += ("where " + strWhere);
            }
            DataTable dt = sqlhelper.GetDataTable(sql, CommandType.Text, null);
            List<jiudian> lis = new List<jiudian>();
            if (dt != null)
            {
                foreach (DataRow row in dt.Rows)
                {
                    lis.Add(RowToModelHelper.jiudianDataRowToModel(row));
                }
            }
            return lis;
        }

        /// <summary>
        /// 根据条件获取系统nianbao列表
        /// </summary>
        /// <param name="strWhere">查询条件</param>
        public List<nianbao> Get_nianbao(string strWhere)
        {
            string sql = "SELECT * FROM nianbao ";
            if (!string.IsNullOrEmpty(strWhere))
            {
                sql += ("where " + strWhere);
            }
            DataTable dt = sqlhelper.GetDataTable(sql, CommandType.Text, null);
            List<nianbao> lis = new List<nianbao>();
            if (dt != null)
            {
                foreach (DataRow row in dt.Rows)
                {
                    lis.Add(RowToModelHelper.nianbaoDataRowToModel(row));
                }
            }
            return lis;
        }

        /// <summary>
        /// 根据条件获取系统t_area列表
        /// </summary>
        /// <param name="strWhere">查询条件</param>
        public List<t_area> Get_t_area(string strWhere)
        {
            string sql = "SELECT * FROM t_area ";
            if (!string.IsNullOrEmpty(strWhere))
            {
                sql += ("where " + strWhere);
            }
            DataTable dt = sqlhelper.GetDataTable(sql, CommandType.Text, null);
            List<t_area> lis = new List<t_area>();
            if (dt != null)
            {
                foreach (DataRow row in dt.Rows)
                {
                    lis.Add(RowToModelHelper.t_areaDataRowToModel(row));
                }
            }
            return lis;
        }

        /// <summary>
        /// 根据条件获取系统yuebao列表
        /// </summary>
        /// <param name="strWhere">查询条件</param>
        public List<yuebao> Get_yuebao(string strWhere)
        {
            string sql = "SELECT * FROM yuebao ";
            if (!string.IsNullOrEmpty(strWhere))
            {
                sql += ("where " + strWhere);
            }
            DataTable dt = sqlhelper.GetDataTable(sql, CommandType.Text, null);
            List<yuebao> lis = new List<yuebao>();
            if (dt != null)
            {
                foreach (DataRow row in dt.Rows)
                {
                    lis.Add(RowToModelHelper.yuebaoDataRowToModel(row));
                }
            }
            return lis;
        }

        /// <summary>
        /// 添加一条注册信息到数据库
        /// </summary>
        /// <param name="modeljd"></param>
        /// <param name="modelyh"></param>
        /// <returns></returns>
        public int Add_ZhuCe(jiudian modeljd, yonghu_jiudian modelyh)
        {
            List<string> lissql = new List<string>();
            List<MySqlParameter[]> lispa = new List<MySqlParameter[]>();
            List<CommandType> liscmd = new List<CommandType>();
            if (true)
            {
                #region 酒店数据
                StringBuilder strSql = new StringBuilder();
                strSql.Append("insert into jiudian(");
                strSql.Append("id,jd_name,faren_danwei,faren_name,tongyi_xinyong_daima,zhuce_dizhi,zhuce_dizhi_youbian,jingying_dizhi,jingying_dizhi_youbian,jingdu,weidu,xingzheng_quhua,has_tehang_xukezheng,has_zhian_xitong,tehangzheng_bianhao,beian_xuliehao,jingying_zhuangtai,zhuce_leixing,jianzhu_leixing_huafen,keren_leixing_huafen,quwei_leixing_huafen,jiage_leixing_huafen,jingying_leixing_huafen,fangshu_leixing_huafen,pinpai_leixing_huafen,xingji_leixing_huafen,minsu_pingji_dengji,zhuangxiu_zaojia,is_xingji,pingxing_riqi,xingji_jianshe_biaozhun,kaiye_riqi,is_pinpai,suoshu_pinpai,suoshu_pinpai_jituan,suoshu_pinpai_guojia,is_liansuo,kefang_zongshu,chuangwei_zongshu,dachuang_fangjian_shuliang,dachuang_chuangwei_shuliang,shuangbiao_fangjian_shuliang,shuangbiao_chuangwei_shuliang,taofang_fangjian_shuliang,taofang_chuangwei_shuliang,wuzhangai_fangjian_shuliang,wuzhangai_chuangwei_shuliang,huiyishi_json,canting_json,guanfang_wangzhan,dianzi_youxiang,dianhua,chuanzhen,danwei_fuzeren,danwei_fuzeren_dianhua,guanlifang,guanlifang_lianxiren,guanlifang_dianhua,yezhufang,yezhufang_lianxiren,yezhufang_dianhua,tese_jieshao,zongtouzi_e,yongdi_mianji,zhandi_mianji,jianzhu_mianji,aid,shenhe_zhuangtai,shenhe_jujue_shuoming,yingye_zhuangtai,yingye_zhuangtai_shuoming,yingye_zhuangtai_shijian,img_yingye_zhizhao,img_faren_shenfenzheng_zheng,img_faren_shenfenzheng_fan,img_shenqingren_sfz_zheng,img_shenqingren_sfz_fan,guid_jdyh,shenqing_shijian,shenhe_shijian,img_tezhong_hangye)");
                strSql.Append(" values (");
                strSql.Append("@id,@jd_name,@faren_danwei,@faren_name,@tongyi_xinyong_daima,@zhuce_dizhi,@zhuce_dizhi_youbian,@jingying_dizhi,@jingying_dizhi_youbian,@jingdu,@weidu,@xingzheng_quhua,@has_tehang_xukezheng,@has_zhian_xitong,@tehangzheng_bianhao,@beian_xuliehao,@jingying_zhuangtai,@zhuce_leixing,@jianzhu_leixing_huafen,@keren_leixing_huafen,@quwei_leixing_huafen,@jiage_leixing_huafen,@jingying_leixing_huafen,@fangshu_leixing_huafen,@pinpai_leixing_huafen,@xingji_leixing_huafen,@minsu_pingji_dengji,@zhuangxiu_zaojia,@is_xingji,@pingxing_riqi,@xingji_jianshe_biaozhun,@kaiye_riqi,@is_pinpai,@suoshu_pinpai,@suoshu_pinpai_jituan,@suoshu_pinpai_guojia,@is_liansuo,@kefang_zongshu,@chuangwei_zongshu,@dachuang_fangjian_shuliang,@dachuang_chuangwei_shuliang,@shuangbiao_fangjian_shuliang,@shuangbiao_chuangwei_shuliang,@taofang_fangjian_shuliang,@taofang_chuangwei_shuliang,@wuzhangai_fangjian_shuliang,@wuzhangai_chuangwei_shuliang,@huiyishi_json,@canting_json,@guanfang_wangzhan,@dianzi_youxiang,@dianhua,@chuanzhen,@danwei_fuzeren,@danwei_fuzeren_dianhua,@guanlifang,@guanlifang_lianxiren,@guanlifang_dianhua,@yezhufang,@yezhufang_lianxiren,@yezhufang_dianhua,@tese_jieshao,@zongtouzi_e,@yongdi_mianji,@zhandi_mianji,@jianzhu_mianji,@aid,@shenhe_zhuangtai,@shenhe_jujue_shuoming,@yingye_zhuangtai,@yingye_zhuangtai_shuoming,@yingye_zhuangtai_shijian,@img_yingye_zhizhao,@img_faren_shenfenzheng_zheng,@img_faren_shenfenzheng_fan,@img_shenqingren_sfz_zheng,@img_shenqingren_sfz_fan,@guid_jdyh,@shenqing_shijian,@shenhe_shijian,@img_tezhong_hangye)");
                MySqlParameter[] parameters = {
                    new MySqlParameter("@id", MySqlDbType.Int32,11),
                    new MySqlParameter("@jd_name", MySqlDbType.VarChar,50),
                    new MySqlParameter("@faren_danwei", MySqlDbType.VarChar,100),
                    new MySqlParameter("@faren_name", MySqlDbType.VarChar,10),
                    new MySqlParameter("@tongyi_xinyong_daima", MySqlDbType.VarChar,100),
                    new MySqlParameter("@zhuce_dizhi", MySqlDbType.VarChar,200),
                    new MySqlParameter("@zhuce_dizhi_youbian", MySqlDbType.VarChar,20),
                    new MySqlParameter("@jingying_dizhi", MySqlDbType.VarChar,200),
                    new MySqlParameter("@jingying_dizhi_youbian", MySqlDbType.VarChar,20),
                    new MySqlParameter("@jingdu", MySqlDbType.Decimal,10),
                    new MySqlParameter("@weidu", MySqlDbType.Decimal,10),
                    new MySqlParameter("@xingzheng_quhua", MySqlDbType.VarChar,100),
                    new MySqlParameter("@has_tehang_xukezheng", MySqlDbType.Bit),
                    new MySqlParameter("@has_zhian_xitong", MySqlDbType.Bit),
                    new MySqlParameter("@tehangzheng_bianhao", MySqlDbType.VarChar,100),
                    new MySqlParameter("@beian_xuliehao", MySqlDbType.VarChar,100),
                    new MySqlParameter("@jingying_zhuangtai", MySqlDbType.VarChar,10),
                    new MySqlParameter("@zhuce_leixing", MySqlDbType.VarChar,20),
                    new MySqlParameter("@jianzhu_leixing_huafen", MySqlDbType.VarChar,10),
                    new MySqlParameter("@keren_leixing_huafen", MySqlDbType.VarChar,10),
                    new MySqlParameter("@quwei_leixing_huafen", MySqlDbType.VarChar,10),
                    new MySqlParameter("@jiage_leixing_huafen", MySqlDbType.VarChar,20),
                    new MySqlParameter("@jingying_leixing_huafen", MySqlDbType.VarChar,20),
                    new MySqlParameter("@fangshu_leixing_huafen", MySqlDbType.VarChar,20),
                    new MySqlParameter("@pinpai_leixing_huafen", MySqlDbType.VarChar,10),
                    new MySqlParameter("@xingji_leixing_huafen", MySqlDbType.VarChar,10),
                    new MySqlParameter("@minsu_pingji_dengji", MySqlDbType.VarChar,10),
                    new MySqlParameter("@zhuangxiu_zaojia", MySqlDbType.VarChar,20),
                    new MySqlParameter("@is_xingji", MySqlDbType.Bit),
                    new MySqlParameter("@pingxing_riqi", MySqlDbType.Date),
                    new MySqlParameter("@xingji_jianshe_biaozhun", MySqlDbType.VarChar,10),
                    new MySqlParameter("@kaiye_riqi", MySqlDbType.Date),
                    new MySqlParameter("@is_pinpai", MySqlDbType.Bit),
                    new MySqlParameter("@suoshu_pinpai", MySqlDbType.VarChar,100),
                    new MySqlParameter("@suoshu_pinpai_jituan", MySqlDbType.VarChar,100),
                    new MySqlParameter("@suoshu_pinpai_guojia", MySqlDbType.VarChar,50),
                    new MySqlParameter("@is_liansuo", MySqlDbType.Bit),
                    new MySqlParameter("@kefang_zongshu", MySqlDbType.Int32,11),
                    new MySqlParameter("@chuangwei_zongshu", MySqlDbType.Int32,11),
                    new MySqlParameter("@dachuang_fangjian_shuliang", MySqlDbType.Int32,11),
                    new MySqlParameter("@dachuang_chuangwei_shuliang", MySqlDbType.Int32,11),
                    new MySqlParameter("@shuangbiao_fangjian_shuliang", MySqlDbType.Int32,11),
                    new MySqlParameter("@shuangbiao_chuangwei_shuliang", MySqlDbType.Int32,11),
                    new MySqlParameter("@taofang_fangjian_shuliang", MySqlDbType.Int32,11),
                    new MySqlParameter("@taofang_chuangwei_shuliang", MySqlDbType.Int32,11),
                    new MySqlParameter("@wuzhangai_fangjian_shuliang", MySqlDbType.Int32,11),
                    new MySqlParameter("@wuzhangai_chuangwei_shuliang", MySqlDbType.Int32,11),
                    new MySqlParameter("@huiyishi_json", MySqlDbType.VarChar,1000),
                    new MySqlParameter("@canting_json", MySqlDbType.VarChar,1000),
                    new MySqlParameter("@guanfang_wangzhan", MySqlDbType.VarChar,200),
                    new MySqlParameter("@dianzi_youxiang", MySqlDbType.VarChar,50),
                    new MySqlParameter("@dianhua", MySqlDbType.VarChar,20),
                    new MySqlParameter("@chuanzhen", MySqlDbType.VarChar,50),
                    new MySqlParameter("@danwei_fuzeren", MySqlDbType.VarChar,10),
                    new MySqlParameter("@danwei_fuzeren_dianhua", MySqlDbType.VarChar,20),
                    new MySqlParameter("@guanlifang", MySqlDbType.VarChar,50),
                    new MySqlParameter("@guanlifang_lianxiren", MySqlDbType.VarChar,10),
                    new MySqlParameter("@guanlifang_dianhua", MySqlDbType.VarChar,20),
                    new MySqlParameter("@yezhufang", MySqlDbType.VarChar,50),
                    new MySqlParameter("@yezhufang_lianxiren", MySqlDbType.VarChar,20),
                    new MySqlParameter("@yezhufang_dianhua", MySqlDbType.VarChar,20),
                    new MySqlParameter("@tese_jieshao", MySqlDbType.Text),
                    new MySqlParameter("@zongtouzi_e", MySqlDbType.Decimal,10),
                    new MySqlParameter("@yongdi_mianji", MySqlDbType.Decimal,10),
                    new MySqlParameter("@zhandi_mianji", MySqlDbType.Decimal,10),
                    new MySqlParameter("@jianzhu_mianji", MySqlDbType.Decimal,10),
                    new MySqlParameter("@aid", MySqlDbType.Int32,11),
                    new MySqlParameter("@shenhe_zhuangtai", MySqlDbType.Int32,11),
                    new MySqlParameter("@shenhe_jujue_shuoming", MySqlDbType.Text),
                    new MySqlParameter("@yingye_zhuangtai", MySqlDbType.Int32,11),
                    new MySqlParameter("@yingye_zhuangtai_shuoming", MySqlDbType.Text),
                    new MySqlParameter("@yingye_zhuangtai_shijian", MySqlDbType.DateTime),
                    new MySqlParameter("@img_yingye_zhizhao", MySqlDbType.VarChar,500),
                    new MySqlParameter("@img_faren_shenfenzheng_zheng", MySqlDbType.VarChar,500),
                    new MySqlParameter("@img_faren_shenfenzheng_fan", MySqlDbType.VarChar,500),
                    new MySqlParameter("@img_shenqingren_sfz_zheng", MySqlDbType.VarChar,500),
                    new MySqlParameter("@img_shenqingren_sfz_fan", MySqlDbType.VarChar,500),
                    new MySqlParameter("@guid_jdyh", MySqlDbType.VarChar,100),
                    new MySqlParameter("@shenqing_shijian", MySqlDbType.DateTime),
                    new MySqlParameter("@shenhe_shijian", MySqlDbType.DateTime),
                    new MySqlParameter("@img_tezhong_hangye", MySqlDbType.VarChar,500)};
                parameters[0].Value = modeljd.id;
                parameters[1].Value = modeljd.jd_name;
                parameters[2].Value = modeljd.faren_danwei;
                parameters[3].Value = modeljd.faren_name;
                parameters[4].Value = modeljd.tongyi_xinyong_daima;
                parameters[5].Value = modeljd.zhuce_dizhi;
                parameters[6].Value = modeljd.zhuce_dizhi_youbian;
                parameters[7].Value = modeljd.jingying_dizhi;
                parameters[8].Value = modeljd.jingying_dizhi_youbian;
                parameters[9].Value = modeljd.jingdu;
                parameters[10].Value = modeljd.weidu;
                parameters[11].Value = modeljd.xingzheng_quhua;
                parameters[12].Value = modeljd.has_tehang_xukezheng;
                parameters[13].Value = modeljd.has_zhian_xitong;
                parameters[14].Value = modeljd.tehangzheng_bianhao;
                parameters[15].Value = modeljd.beian_xuliehao;
                parameters[16].Value = modeljd.jingying_zhuangtai;
                parameters[17].Value = modeljd.zhuce_leixing;
                parameters[18].Value = modeljd.jianzhu_leixing_huafen;
                parameters[19].Value = modeljd.keren_leixing_huafen;
                parameters[20].Value = modeljd.quwei_leixing_huafen;
                parameters[21].Value = modeljd.jiage_leixing_huafen;
                parameters[22].Value = modeljd.jingying_leixing_huafen;
                parameters[23].Value = modeljd.fangshu_leixing_huafen;
                parameters[24].Value = modeljd.pinpai_leixing_huafen;
                parameters[25].Value = modeljd.xingji_leixing_huafen;
                parameters[26].Value = modeljd.minsu_pingji_dengji;
                parameters[27].Value = modeljd.zhuangxiu_zaojia;
                parameters[28].Value = modeljd.is_xingji;
                parameters[29].Value = modeljd.pingxing_riqi;
                parameters[30].Value = modeljd.xingji_jianshe_biaozhun;
                parameters[31].Value = modeljd.kaiye_riqi;
                parameters[32].Value = modeljd.is_pinpai;
                parameters[33].Value = modeljd.suoshu_pinpai;
                parameters[34].Value = modeljd.suoshu_pinpai_jituan;
                parameters[35].Value = modeljd.suoshu_pinpai_guojia;
                parameters[36].Value = modeljd.is_liansuo;
                parameters[37].Value = modeljd.kefang_zongshu;
                parameters[38].Value = modeljd.chuangwei_zongshu;
                parameters[39].Value = modeljd.dachuang_fangjian_shuliang;
                parameters[40].Value = modeljd.dachuang_chuangwei_shuliang;
                parameters[41].Value = modeljd.shuangbiao_fangjian_shuliang;
                parameters[42].Value = modeljd.shuangbiao_chuangwei_shuliang;
                parameters[43].Value = modeljd.taofang_fangjian_shuliang;
                parameters[44].Value = modeljd.taofang_chuangwei_shuliang;
                parameters[45].Value = modeljd.wuzhangai_fangjian_shuliang;
                parameters[46].Value = modeljd.wuzhangai_chuangwei_shuliang;
                parameters[47].Value = modeljd.huiyishi_json;
                parameters[48].Value = modeljd.canting_json;
                parameters[49].Value = modeljd.guanfang_wangzhan;
                parameters[50].Value = modeljd.dianzi_youxiang;
                parameters[51].Value = modeljd.dianhua;
                parameters[52].Value = modeljd.chuanzhen;
                parameters[53].Value = modeljd.danwei_fuzeren;
                parameters[54].Value = modeljd.danwei_fuzeren_dianhua;
                parameters[55].Value = modeljd.guanlifang;
                parameters[56].Value = modeljd.guanlifang_lianxiren;
                parameters[57].Value = modeljd.guanlifang_dianhua;
                parameters[58].Value = modeljd.yezhufang;
                parameters[59].Value = modeljd.yezhufang_lianxiren;
                parameters[60].Value = modeljd.yezhufang_dianhua;
                parameters[61].Value = modeljd.tese_jieshao;
                parameters[62].Value = modeljd.zongtouzi_e;
                parameters[63].Value = modeljd.yongdi_mianji;
                parameters[64].Value = modeljd.zhandi_mianji;
                parameters[65].Value = modeljd.jianzhu_mianji;
                parameters[66].Value = modeljd.aid;
                parameters[67].Value = modeljd.shenhe_zhuangtai;
                parameters[68].Value = modeljd.shenhe_jujue_shuoming;
                parameters[69].Value = modeljd.yingye_zhuangtai;
                parameters[70].Value = modeljd.yingye_zhuangtai_shuoming;
                parameters[71].Value = modeljd.yingye_zhuangtai_shijian;
                parameters[72].Value = modeljd.img_yingye_zhizhao;
                parameters[73].Value = modeljd.img_faren_shenfenzheng_zheng;
                parameters[74].Value = modeljd.img_faren_shenfenzheng_fan;
                parameters[75].Value = modeljd.img_shenqingren_sfz_zheng;
                parameters[76].Value = modeljd.img_shenqingren_sfz_fan;
                parameters[77].Value = modeljd.guid_jdyh;
                parameters[78].Value = modeljd.shenqing_shijian;
                parameters[79].Value = modeljd.shenhe_shijian;
                parameters[80].Value = modeljd.img_tezhong_hangye;

                lissql.Add(strSql.ToString());
                lispa.Add(parameters);
                liscmd.Add(CommandType.Text);
                #endregion
            }
            if (true)
            {
                #region 用户酒店数据
                StringBuilder strSql = new StringBuilder();
                strSql.Append("insert into yonghu_jiudian(");
                strSql.Append("id,zhanghao,zhuangtai,jdid_json,leixing,xingming,guid_jdyh)");
                strSql.Append(" values (");
                strSql.Append("@id,@zhanghao,@zhuangtai,@jdid_json,@leixing,@xingming,@guid_jdyh)");
                MySqlParameter[] parameters = {
                    new MySqlParameter("@id", MySqlDbType.Int32,11),
                    new MySqlParameter("@zhanghao", MySqlDbType.VarChar,20),
                    new MySqlParameter("@zhuangtai", MySqlDbType.Int32,11),
                    new MySqlParameter("@jdid_json", MySqlDbType.VarChar,1000),
                    new MySqlParameter("@leixing", MySqlDbType.Int32,11),
                    new MySqlParameter("@xingming", MySqlDbType.VarChar,10),
                    new MySqlParameter("@guid_jdyh", MySqlDbType.VarChar,100)};
                parameters[0].Value = modelyh.id;
                parameters[1].Value = modelyh.zhanghao;
                parameters[2].Value = modelyh.zhuangtai;
                parameters[3].Value = modelyh.jdid_json;
                parameters[4].Value = modelyh.leixing;
                parameters[5].Value = modelyh.xingming;
                parameters[6].Value = modelyh.guid_jdyh;

                lissql.Add(strSql.ToString());
                lispa.Add(parameters);
                liscmd.Add(CommandType.Text);
                #endregion
            }
            //写入数据库
            int res = sqlhelper.ExecuteNonQueryWithTransaction(lissql, liscmd, lispa);

            return res;


        }

        /// <summary>
        /// 添加一条注册信息到数据库 子酒店
        /// </summary>
        /// <param name="modeljd"></param>
        /// <returns></returns>
        public int Add_ZhuCeSub(jiudian modeljd)
        {
            List<string> lissql = new List<string>();
            List<MySqlParameter[]> lispa = new List<MySqlParameter[]>();
            List<CommandType> liscmd = new List<CommandType>();
            if (true)
            {
                #region 酒店数据
                StringBuilder strSql = new StringBuilder();
                strSql.Append("insert into jiudian(");
                strSql.Append("id,jd_name,faren_danwei,faren_name,tongyi_xinyong_daima,zhuce_dizhi,zhuce_dizhi_youbian,jingying_dizhi,jingying_dizhi_youbian,jingdu,weidu,xingzheng_quhua,has_tehang_xukezheng,has_zhian_xitong,tehangzheng_bianhao,beian_xuliehao,jingying_zhuangtai,zhuce_leixing,jianzhu_leixing_huafen,keren_leixing_huafen,quwei_leixing_huafen,jiage_leixing_huafen,jingying_leixing_huafen,fangshu_leixing_huafen,pinpai_leixing_huafen,xingji_leixing_huafen,minsu_pingji_dengji,zhuangxiu_zaojia,is_xingji,pingxing_riqi,xingji_jianshe_biaozhun,kaiye_riqi,is_pinpai,suoshu_pinpai,suoshu_pinpai_jituan,suoshu_pinpai_guojia,is_liansuo,kefang_zongshu,chuangwei_zongshu,dachuang_fangjian_shuliang,dachuang_chuangwei_shuliang,shuangbiao_fangjian_shuliang,shuangbiao_chuangwei_shuliang,taofang_fangjian_shuliang,taofang_chuangwei_shuliang,wuzhangai_fangjian_shuliang,wuzhangai_chuangwei_shuliang,huiyishi_json,canting_json,guanfang_wangzhan,dianzi_youxiang,dianhua,chuanzhen,danwei_fuzeren,danwei_fuzeren_dianhua,guanlifang,guanlifang_lianxiren,guanlifang_dianhua,yezhufang,yezhufang_lianxiren,yezhufang_dianhua,tese_jieshao,zongtouzi_e,yongdi_mianji,zhandi_mianji,jianzhu_mianji,aid,shenhe_zhuangtai,shenhe_jujue_shuoming,yingye_zhuangtai,yingye_zhuangtai_shuoming,yingye_zhuangtai_shijian,img_yingye_zhizhao,img_faren_shenfenzheng_zheng,img_faren_shenfenzheng_fan,img_shenqingren_sfz_zheng,img_shenqingren_sfz_fan,guid_jdyh,shenqing_shijian,shenhe_shijian,img_tezhong_hangye)");
                strSql.Append(" values (");
                strSql.Append("@id,@jd_name,@faren_danwei,@faren_name,@tongyi_xinyong_daima,@zhuce_dizhi,@zhuce_dizhi_youbian,@jingying_dizhi,@jingying_dizhi_youbian,@jingdu,@weidu,@xingzheng_quhua,@has_tehang_xukezheng,@has_zhian_xitong,@tehangzheng_bianhao,@beian_xuliehao,@jingying_zhuangtai,@zhuce_leixing,@jianzhu_leixing_huafen,@keren_leixing_huafen,@quwei_leixing_huafen,@jiage_leixing_huafen,@jingying_leixing_huafen,@fangshu_leixing_huafen,@pinpai_leixing_huafen,@xingji_leixing_huafen,@minsu_pingji_dengji,@zhuangxiu_zaojia,@is_xingji,@pingxing_riqi,@xingji_jianshe_biaozhun,@kaiye_riqi,@is_pinpai,@suoshu_pinpai,@suoshu_pinpai_jituan,@suoshu_pinpai_guojia,@is_liansuo,@kefang_zongshu,@chuangwei_zongshu,@dachuang_fangjian_shuliang,@dachuang_chuangwei_shuliang,@shuangbiao_fangjian_shuliang,@shuangbiao_chuangwei_shuliang,@taofang_fangjian_shuliang,@taofang_chuangwei_shuliang,@wuzhangai_fangjian_shuliang,@wuzhangai_chuangwei_shuliang,@huiyishi_json,@canting_json,@guanfang_wangzhan,@dianzi_youxiang,@dianhua,@chuanzhen,@danwei_fuzeren,@danwei_fuzeren_dianhua,@guanlifang,@guanlifang_lianxiren,@guanlifang_dianhua,@yezhufang,@yezhufang_lianxiren,@yezhufang_dianhua,@tese_jieshao,@zongtouzi_e,@yongdi_mianji,@zhandi_mianji,@jianzhu_mianji,@aid,@shenhe_zhuangtai,@shenhe_jujue_shuoming,@yingye_zhuangtai,@yingye_zhuangtai_shuoming,@yingye_zhuangtai_shijian,@img_yingye_zhizhao,@img_faren_shenfenzheng_zheng,@img_faren_shenfenzheng_fan,@img_shenqingren_sfz_zheng,@img_shenqingren_sfz_fan,@guid_jdyh,@shenqing_shijian,@shenhe_shijian,@img_tezhong_hangye)");
                MySqlParameter[] parameters = {
                    new MySqlParameter("@id", MySqlDbType.Int32,11),
                    new MySqlParameter("@jd_name", MySqlDbType.VarChar,50),
                    new MySqlParameter("@faren_danwei", MySqlDbType.VarChar,100),
                    new MySqlParameter("@faren_name", MySqlDbType.VarChar,10),
                    new MySqlParameter("@tongyi_xinyong_daima", MySqlDbType.VarChar,100),
                    new MySqlParameter("@zhuce_dizhi", MySqlDbType.VarChar,200),
                    new MySqlParameter("@zhuce_dizhi_youbian", MySqlDbType.VarChar,20),
                    new MySqlParameter("@jingying_dizhi", MySqlDbType.VarChar,200),
                    new MySqlParameter("@jingying_dizhi_youbian", MySqlDbType.VarChar,20),
                    new MySqlParameter("@jingdu", MySqlDbType.Decimal,10),
                    new MySqlParameter("@weidu", MySqlDbType.Decimal,10),
                    new MySqlParameter("@xingzheng_quhua", MySqlDbType.VarChar,100),
                    new MySqlParameter("@has_tehang_xukezheng", MySqlDbType.Bit),
                    new MySqlParameter("@has_zhian_xitong", MySqlDbType.Bit),
                    new MySqlParameter("@tehangzheng_bianhao", MySqlDbType.VarChar,100),
                    new MySqlParameter("@beian_xuliehao", MySqlDbType.VarChar,100),
                    new MySqlParameter("@jingying_zhuangtai", MySqlDbType.VarChar,10),
                    new MySqlParameter("@zhuce_leixing", MySqlDbType.VarChar,20),
                    new MySqlParameter("@jianzhu_leixing_huafen", MySqlDbType.VarChar,10),
                    new MySqlParameter("@keren_leixing_huafen", MySqlDbType.VarChar,10),
                    new MySqlParameter("@quwei_leixing_huafen", MySqlDbType.VarChar,10),
                    new MySqlParameter("@jiage_leixing_huafen", MySqlDbType.VarChar,20),
                    new MySqlParameter("@jingying_leixing_huafen", MySqlDbType.VarChar,20),
                    new MySqlParameter("@fangshu_leixing_huafen", MySqlDbType.VarChar,20),
                    new MySqlParameter("@pinpai_leixing_huafen", MySqlDbType.VarChar,10),
                    new MySqlParameter("@xingji_leixing_huafen", MySqlDbType.VarChar,10),
                    new MySqlParameter("@minsu_pingji_dengji", MySqlDbType.VarChar,10),
                    new MySqlParameter("@zhuangxiu_zaojia", MySqlDbType.VarChar,20),
                    new MySqlParameter("@is_xingji", MySqlDbType.Bit),
                    new MySqlParameter("@pingxing_riqi", MySqlDbType.Date),
                    new MySqlParameter("@xingji_jianshe_biaozhun", MySqlDbType.VarChar,10),
                    new MySqlParameter("@kaiye_riqi", MySqlDbType.Date),
                    new MySqlParameter("@is_pinpai", MySqlDbType.Bit),
                    new MySqlParameter("@suoshu_pinpai", MySqlDbType.VarChar,100),
                    new MySqlParameter("@suoshu_pinpai_jituan", MySqlDbType.VarChar,100),
                    new MySqlParameter("@suoshu_pinpai_guojia", MySqlDbType.VarChar,50),
                    new MySqlParameter("@is_liansuo", MySqlDbType.Bit),
                    new MySqlParameter("@kefang_zongshu", MySqlDbType.Int32,11),
                    new MySqlParameter("@chuangwei_zongshu", MySqlDbType.Int32,11),
                    new MySqlParameter("@dachuang_fangjian_shuliang", MySqlDbType.Int32,11),
                    new MySqlParameter("@dachuang_chuangwei_shuliang", MySqlDbType.Int32,11),
                    new MySqlParameter("@shuangbiao_fangjian_shuliang", MySqlDbType.Int32,11),
                    new MySqlParameter("@shuangbiao_chuangwei_shuliang", MySqlDbType.Int32,11),
                    new MySqlParameter("@taofang_fangjian_shuliang", MySqlDbType.Int32,11),
                    new MySqlParameter("@taofang_chuangwei_shuliang", MySqlDbType.Int32,11),
                    new MySqlParameter("@wuzhangai_fangjian_shuliang", MySqlDbType.Int32,11),
                    new MySqlParameter("@wuzhangai_chuangwei_shuliang", MySqlDbType.Int32,11),
                    new MySqlParameter("@huiyishi_json", MySqlDbType.VarChar,1000),
                    new MySqlParameter("@canting_json", MySqlDbType.VarChar,1000),
                    new MySqlParameter("@guanfang_wangzhan", MySqlDbType.VarChar,200),
                    new MySqlParameter("@dianzi_youxiang", MySqlDbType.VarChar,50),
                    new MySqlParameter("@dianhua", MySqlDbType.VarChar,20),
                    new MySqlParameter("@chuanzhen", MySqlDbType.VarChar,50),
                    new MySqlParameter("@danwei_fuzeren", MySqlDbType.VarChar,10),
                    new MySqlParameter("@danwei_fuzeren_dianhua", MySqlDbType.VarChar,20),
                    new MySqlParameter("@guanlifang", MySqlDbType.VarChar,50),
                    new MySqlParameter("@guanlifang_lianxiren", MySqlDbType.VarChar,10),
                    new MySqlParameter("@guanlifang_dianhua", MySqlDbType.VarChar,20),
                    new MySqlParameter("@yezhufang", MySqlDbType.VarChar,50),
                    new MySqlParameter("@yezhufang_lianxiren", MySqlDbType.VarChar,20),
                    new MySqlParameter("@yezhufang_dianhua", MySqlDbType.VarChar,20),
                    new MySqlParameter("@tese_jieshao", MySqlDbType.Text),
                    new MySqlParameter("@zongtouzi_e", MySqlDbType.Decimal,10),
                    new MySqlParameter("@yongdi_mianji", MySqlDbType.Decimal,10),
                    new MySqlParameter("@zhandi_mianji", MySqlDbType.Decimal,10),
                    new MySqlParameter("@jianzhu_mianji", MySqlDbType.Decimal,10),
                    new MySqlParameter("@aid", MySqlDbType.Int32,11),
                    new MySqlParameter("@shenhe_zhuangtai", MySqlDbType.Int32,11),
                    new MySqlParameter("@shenhe_jujue_shuoming", MySqlDbType.Text),
                    new MySqlParameter("@yingye_zhuangtai", MySqlDbType.Int32,11),
                    new MySqlParameter("@yingye_zhuangtai_shuoming", MySqlDbType.Text),
                    new MySqlParameter("@yingye_zhuangtai_shijian", MySqlDbType.DateTime),
                    new MySqlParameter("@img_yingye_zhizhao", MySqlDbType.VarChar,500),
                    new MySqlParameter("@img_faren_shenfenzheng_zheng", MySqlDbType.VarChar,500),
                    new MySqlParameter("@img_faren_shenfenzheng_fan", MySqlDbType.VarChar,500),
                    new MySqlParameter("@img_shenqingren_sfz_zheng", MySqlDbType.VarChar,500),
                    new MySqlParameter("@img_shenqingren_sfz_fan", MySqlDbType.VarChar,500),
                    new MySqlParameter("@guid_jdyh", MySqlDbType.VarChar,100),
                    new MySqlParameter("@shenqing_shijian", MySqlDbType.DateTime),
                    new MySqlParameter("@shenhe_shijian", MySqlDbType.DateTime),
                    new MySqlParameter("@img_tezhong_hangye", MySqlDbType.VarChar,500)};
                parameters[0].Value = modeljd.id;
                parameters[1].Value = modeljd.jd_name;
                parameters[2].Value = modeljd.faren_danwei;
                parameters[3].Value = modeljd.faren_name;
                parameters[4].Value = modeljd.tongyi_xinyong_daima;
                parameters[5].Value = modeljd.zhuce_dizhi;
                parameters[6].Value = modeljd.zhuce_dizhi_youbian;
                parameters[7].Value = modeljd.jingying_dizhi;
                parameters[8].Value = modeljd.jingying_dizhi_youbian;
                parameters[9].Value = modeljd.jingdu;
                parameters[10].Value = modeljd.weidu;
                parameters[11].Value = modeljd.xingzheng_quhua;
                parameters[12].Value = modeljd.has_tehang_xukezheng;
                parameters[13].Value = modeljd.has_zhian_xitong;
                parameters[14].Value = modeljd.tehangzheng_bianhao;
                parameters[15].Value = modeljd.beian_xuliehao;
                parameters[16].Value = modeljd.jingying_zhuangtai;
                parameters[17].Value = modeljd.zhuce_leixing;
                parameters[18].Value = modeljd.jianzhu_leixing_huafen;
                parameters[19].Value = modeljd.keren_leixing_huafen;
                parameters[20].Value = modeljd.quwei_leixing_huafen;
                parameters[21].Value = modeljd.jiage_leixing_huafen;
                parameters[22].Value = modeljd.jingying_leixing_huafen;
                parameters[23].Value = modeljd.fangshu_leixing_huafen;
                parameters[24].Value = modeljd.pinpai_leixing_huafen;
                parameters[25].Value = modeljd.xingji_leixing_huafen;
                parameters[26].Value = modeljd.minsu_pingji_dengji;
                parameters[27].Value = modeljd.zhuangxiu_zaojia;
                parameters[28].Value = modeljd.is_xingji;
                parameters[29].Value = modeljd.pingxing_riqi;
                parameters[30].Value = modeljd.xingji_jianshe_biaozhun;
                parameters[31].Value = modeljd.kaiye_riqi;
                parameters[32].Value = modeljd.is_pinpai;
                parameters[33].Value = modeljd.suoshu_pinpai;
                parameters[34].Value = modeljd.suoshu_pinpai_jituan;
                parameters[35].Value = modeljd.suoshu_pinpai_guojia;
                parameters[36].Value = modeljd.is_liansuo;
                parameters[37].Value = modeljd.kefang_zongshu;
                parameters[38].Value = modeljd.chuangwei_zongshu;
                parameters[39].Value = modeljd.dachuang_fangjian_shuliang;
                parameters[40].Value = modeljd.dachuang_chuangwei_shuliang;
                parameters[41].Value = modeljd.shuangbiao_fangjian_shuliang;
                parameters[42].Value = modeljd.shuangbiao_chuangwei_shuliang;
                parameters[43].Value = modeljd.taofang_fangjian_shuliang;
                parameters[44].Value = modeljd.taofang_chuangwei_shuliang;
                parameters[45].Value = modeljd.wuzhangai_fangjian_shuliang;
                parameters[46].Value = modeljd.wuzhangai_chuangwei_shuliang;
                parameters[47].Value = modeljd.huiyishi_json;
                parameters[48].Value = modeljd.canting_json;
                parameters[49].Value = modeljd.guanfang_wangzhan;
                parameters[50].Value = modeljd.dianzi_youxiang;
                parameters[51].Value = modeljd.dianhua;
                parameters[52].Value = modeljd.chuanzhen;
                parameters[53].Value = modeljd.danwei_fuzeren;
                parameters[54].Value = modeljd.danwei_fuzeren_dianhua;
                parameters[55].Value = modeljd.guanlifang;
                parameters[56].Value = modeljd.guanlifang_lianxiren;
                parameters[57].Value = modeljd.guanlifang_dianhua;
                parameters[58].Value = modeljd.yezhufang;
                parameters[59].Value = modeljd.yezhufang_lianxiren;
                parameters[60].Value = modeljd.yezhufang_dianhua;
                parameters[61].Value = modeljd.tese_jieshao;
                parameters[62].Value = modeljd.zongtouzi_e;
                parameters[63].Value = modeljd.yongdi_mianji;
                parameters[64].Value = modeljd.zhandi_mianji;
                parameters[65].Value = modeljd.jianzhu_mianji;
                parameters[66].Value = modeljd.aid;
                parameters[67].Value = modeljd.shenhe_zhuangtai;
                parameters[68].Value = modeljd.shenhe_jujue_shuoming;
                parameters[69].Value = modeljd.yingye_zhuangtai;
                parameters[70].Value = modeljd.yingye_zhuangtai_shuoming;
                parameters[71].Value = modeljd.yingye_zhuangtai_shijian;
                parameters[72].Value = modeljd.img_yingye_zhizhao;
                parameters[73].Value = modeljd.img_faren_shenfenzheng_zheng;
                parameters[74].Value = modeljd.img_faren_shenfenzheng_fan;
                parameters[75].Value = modeljd.img_shenqingren_sfz_zheng;
                parameters[76].Value = modeljd.img_shenqingren_sfz_fan;
                parameters[77].Value = modeljd.guid_jdyh;
                parameters[78].Value = modeljd.shenqing_shijian;
                parameters[79].Value = modeljd.shenhe_shijian;
                parameters[80].Value = modeljd.img_tezhong_hangye;

                lissql.Add(strSql.ToString());
                lispa.Add(parameters);
                liscmd.Add(CommandType.Text);
                #endregion
            }            
            //写入数据库
            int res = sqlhelper.ExecuteNonQueryWithTransaction(lissql, liscmd, lispa);

            return res;


        }

        /// <summary>
        /// 根据条件获取baobiao_zhuangtai的条数
        /// </summary>
        /// <param name="strWhere">条件</param>
        /// <returns></returns>
        public int Get_BBZhuangTaiCount(string strWhere)
        {
            string sql = string.Format("SELECT COUNT(*) FROM baobiao_zhuangtai "); ;
            if (!string.IsNullOrEmpty(strWhere))
            {
                sql += " where " + strWhere;
            }
            object obj = sqlhelper.ExecuteScalar(sql, CommandType.Text, null);
            if (obj == null)
                return 0;
            int count = 0;
            if (!int.TryParse(obj.ToString(), out count))
            {
                return 0;
            }
            return count;
        }

        /// <summary>
        /// 新增一条年报数据
        /// </summary>
        /// <param name="model">年报数据</param>
        /// <param name="modelbbzt">报表状态数据</param>
        /// <returns></returns>
        public int Add_nianbao(nianbao model, baobiao_zhuangtai modelbbzt)
        {
            List<string> lissql = new List<string>();
            List<CommandType> liscmd = new List<CommandType>();
            List<MySqlParameter[]> lispa = new List<MySqlParameter[]>();

            if (true)
            {
                #region nianbao
                StringBuilder strSql = new StringBuilder();
                strSql.Append("insert into nianbao(");
                strSql.Append("id,jdid,liudong_zichan_xiaoji,cunhuo,changqi_touzi,guding_zichan_xiaoji,guding_zichan_yuanjia,leiji_zhejiu,bennian_zhejiu,zichan_heji,fuzhai_heji,suoyouzhe_quanyi_heji,shishou_ziben,yingye_shouru,kefang_shouru,canyin_shouru,qita_shouru,yingyewai_shouru,qiye_daikuan,zhengfu_butie,yingye_chengben,nenghao_chengben,yingye_feiyong,yingye_shuijin_ji_fujia,guanli_feiyong,shuijin,chailv_feiyong,caiwu_feiyong,lixi_zhichu,xiaoshou_feiyong,gongyun_jiazhi_biandong_shouyi,yingye_lirun,touzi_shouyi,lirun_zonge,suodeshui,yingjiao_zengzhishui,yingfu_zhigong_xinchou,zhigong_jiaona_shebao,zhigong_jiaona_gongjijin,congye_nianpingjun_renshu,congye_renyuan_liushilv,pingjun_chuzulv,shiji_chuzu_jianyeshu,kegong_chuzu_jianyeshu,is_qiye_kuaiji_zhunze,qiye_kuaiji_zhunze_suishi,shenhe_zhuangtai,shenhe_jujue_shuoming,shenhe_ren,shenhe_shijian,fabu_shijian_kaishi,fabu_shijian_jiezhi,tianbao_shijian,baobiao_mingcheng,bbid,tianbiao_ren,tianbiao_ren_dianhua,has_zanting,zanting_shuoming,yyjdid,yywltid,bb_riqi)");
                strSql.Append(" values (");
                strSql.Append("@id,@jdid,@liudong_zichan_xiaoji,@cunhuo,@changqi_touzi,@guding_zichan_xiaoji,@guding_zichan_yuanjia,@leiji_zhejiu,@bennian_zhejiu,@zichan_heji,@fuzhai_heji,@suoyouzhe_quanyi_heji,@shishou_ziben,@yingye_shouru,@kefang_shouru,@canyin_shouru,@qita_shouru,@yingyewai_shouru,@qiye_daikuan,@zhengfu_butie,@yingye_chengben,@nenghao_chengben,@yingye_feiyong,@yingye_shuijin_ji_fujia,@guanli_feiyong,@shuijin,@chailv_feiyong,@caiwu_feiyong,@lixi_zhichu,@xiaoshou_feiyong,@gongyun_jiazhi_biandong_shouyi,@yingye_lirun,@touzi_shouyi,@lirun_zonge,@suodeshui,@yingjiao_zengzhishui,@yingfu_zhigong_xinchou,@zhigong_jiaona_shebao,@zhigong_jiaona_gongjijin,@congye_nianpingjun_renshu,@congye_renyuan_liushilv,@pingjun_chuzulv,@shiji_chuzu_jianyeshu,@kegong_chuzu_jianyeshu,@is_qiye_kuaiji_zhunze,@qiye_kuaiji_zhunze_suishi,@shenhe_zhuangtai,@shenhe_jujue_shuoming,@shenhe_ren,@shenhe_shijian,@fabu_shijian_kaishi,@fabu_shijian_jiezhi,@tianbao_shijian,@baobiao_mingcheng,@bbid,@tianbiao_ren,@tianbiao_ren_dianhua,@has_zanting,@zanting_shuoming,@yyjdid,@yywltid,@bb_riqi)");
                MySqlParameter[] parameters = {
                    new MySqlParameter("@id", MySqlDbType.Int64,20),
                    new MySqlParameter("@jdid", MySqlDbType.Int32,11),
                    new MySqlParameter("@liudong_zichan_xiaoji", MySqlDbType.Decimal,10),
                    new MySqlParameter("@cunhuo", MySqlDbType.Decimal,10),
                    new MySqlParameter("@changqi_touzi", MySqlDbType.Decimal,10),
                    new MySqlParameter("@guding_zichan_xiaoji", MySqlDbType.Decimal,10),
                    new MySqlParameter("@guding_zichan_yuanjia", MySqlDbType.Decimal,10),
                    new MySqlParameter("@leiji_zhejiu", MySqlDbType.Decimal,10),
                    new MySqlParameter("@bennian_zhejiu", MySqlDbType.Decimal,10),
                    new MySqlParameter("@zichan_heji", MySqlDbType.Decimal,10),
                    new MySqlParameter("@fuzhai_heji", MySqlDbType.Decimal,10),
                    new MySqlParameter("@suoyouzhe_quanyi_heji", MySqlDbType.Decimal,10),
                    new MySqlParameter("@shishou_ziben", MySqlDbType.Decimal,10),
                    new MySqlParameter("@yingye_shouru", MySqlDbType.Decimal,10),
                    new MySqlParameter("@kefang_shouru", MySqlDbType.Decimal,10),
                    new MySqlParameter("@canyin_shouru", MySqlDbType.Decimal,10),
                    new MySqlParameter("@qita_shouru", MySqlDbType.Decimal,10),
                    new MySqlParameter("@yingyewai_shouru", MySqlDbType.Decimal,10),
                    new MySqlParameter("@qiye_daikuan", MySqlDbType.Decimal,10),
                    new MySqlParameter("@zhengfu_butie", MySqlDbType.Decimal,10),
                    new MySqlParameter("@yingye_chengben", MySqlDbType.Decimal,10),
                    new MySqlParameter("@nenghao_chengben", MySqlDbType.Decimal,10),
                    new MySqlParameter("@yingye_feiyong", MySqlDbType.Decimal,10),
                    new MySqlParameter("@yingye_shuijin_ji_fujia", MySqlDbType.Decimal,10),
                    new MySqlParameter("@guanli_feiyong", MySqlDbType.Decimal,10),
                    new MySqlParameter("@shuijin", MySqlDbType.Decimal,10),
                    new MySqlParameter("@chailv_feiyong", MySqlDbType.Decimal,10),
                    new MySqlParameter("@caiwu_feiyong", MySqlDbType.Decimal,10),
                    new MySqlParameter("@lixi_zhichu", MySqlDbType.Decimal,10),
                    new MySqlParameter("@xiaoshou_feiyong", MySqlDbType.Decimal,10),
                    new MySqlParameter("@gongyun_jiazhi_biandong_shouyi", MySqlDbType.Decimal,10),
                    new MySqlParameter("@yingye_lirun", MySqlDbType.Decimal,10),
                    new MySqlParameter("@touzi_shouyi", MySqlDbType.Decimal,10),
                    new MySqlParameter("@lirun_zonge", MySqlDbType.Decimal,10),
                    new MySqlParameter("@suodeshui", MySqlDbType.Decimal,10),
                    new MySqlParameter("@yingjiao_zengzhishui", MySqlDbType.Decimal,10),
                    new MySqlParameter("@yingfu_zhigong_xinchou", MySqlDbType.Decimal,10),
                    new MySqlParameter("@zhigong_jiaona_shebao", MySqlDbType.Decimal,10),
                    new MySqlParameter("@zhigong_jiaona_gongjijin", MySqlDbType.Decimal,10),
                    new MySqlParameter("@congye_nianpingjun_renshu", MySqlDbType.Decimal,10),
                    new MySqlParameter("@congye_renyuan_liushilv", MySqlDbType.Decimal,10),
                    new MySqlParameter("@pingjun_chuzulv", MySqlDbType.Decimal,10),
                    new MySqlParameter("@shiji_chuzu_jianyeshu", MySqlDbType.Int32,11),
                    new MySqlParameter("@kegong_chuzu_jianyeshu", MySqlDbType.Int32,11),
                    new MySqlParameter("@is_qiye_kuaiji_zhunze", MySqlDbType.Bit),
                    new MySqlParameter("@qiye_kuaiji_zhunze_suishi", MySqlDbType.Decimal,10),
                    new MySqlParameter("@shenhe_zhuangtai", MySqlDbType.Int32,11),
                    new MySqlParameter("@shenhe_jujue_shuoming", MySqlDbType.Text),
                    new MySqlParameter("@shenhe_ren", MySqlDbType.VarChar,10),
                    new MySqlParameter("@shenhe_shijian", MySqlDbType.DateTime),
                    new MySqlParameter("@fabu_shijian_kaishi", MySqlDbType.DateTime),
                    new MySqlParameter("@fabu_shijian_jiezhi", MySqlDbType.DateTime),
                    new MySqlParameter("@tianbao_shijian", MySqlDbType.DateTime),
                    new MySqlParameter("@baobiao_mingcheng", MySqlDbType.VarChar,20),
                    new MySqlParameter("@bbid", MySqlDbType.Int64,20),
                    new MySqlParameter("@tianbiao_ren", MySqlDbType.VarChar,10),
                    new MySqlParameter("@tianbiao_ren_dianhua", MySqlDbType.VarChar,20),
                    new MySqlParameter("@has_zanting", MySqlDbType.Bit),
                    new MySqlParameter("@zanting_shuoming", MySqlDbType.Text),
                    new MySqlParameter("@yyjdid", MySqlDbType.Int32,11),
                    new MySqlParameter("@yywltid", MySqlDbType.Int32,11),
                    new MySqlParameter("@bb_riqi", MySqlDbType.Date)};
                parameters[0].Value = model.id;
                parameters[1].Value = model.jdid;
                parameters[2].Value = model.liudong_zichan_xiaoji;
                parameters[3].Value = model.cunhuo;
                parameters[4].Value = model.changqi_touzi;
                parameters[5].Value = model.guding_zichan_xiaoji;
                parameters[6].Value = model.guding_zichan_yuanjia;
                parameters[7].Value = model.leiji_zhejiu;
                parameters[8].Value = model.bennian_zhejiu;
                parameters[9].Value = model.zichan_heji;
                parameters[10].Value = model.fuzhai_heji;
                parameters[11].Value = model.suoyouzhe_quanyi_heji;
                parameters[12].Value = model.shishou_ziben;
                parameters[13].Value = model.yingye_shouru;
                parameters[14].Value = model.kefang_shouru;
                parameters[15].Value = model.canyin_shouru;
                parameters[16].Value = model.qita_shouru;
                parameters[17].Value = model.yingyewai_shouru;
                parameters[18].Value = model.qiye_daikuan;
                parameters[19].Value = model.zhengfu_butie;
                parameters[20].Value = model.yingye_chengben;
                parameters[21].Value = model.nenghao_chengben;
                parameters[22].Value = model.yingye_feiyong;
                parameters[23].Value = model.yingye_shuijin_ji_fujia;
                parameters[24].Value = model.guanli_feiyong;
                parameters[25].Value = model.shuijin;
                parameters[26].Value = model.chailv_feiyong;
                parameters[27].Value = model.caiwu_feiyong;
                parameters[28].Value = model.lixi_zhichu;
                parameters[29].Value = model.xiaoshou_feiyong;
                parameters[30].Value = model.gongyun_jiazhi_biandong_shouyi;
                parameters[31].Value = model.yingye_lirun;
                parameters[32].Value = model.touzi_shouyi;
                parameters[33].Value = model.lirun_zonge;
                parameters[34].Value = model.suodeshui;
                parameters[35].Value = model.yingjiao_zengzhishui;
                parameters[36].Value = model.yingfu_zhigong_xinchou;
                parameters[37].Value = model.zhigong_jiaona_shebao;
                parameters[38].Value = model.zhigong_jiaona_gongjijin;
                parameters[39].Value = model.congye_nianpingjun_renshu;
                parameters[40].Value = model.congye_renyuan_liushilv;
                parameters[41].Value = model.pingjun_chuzulv;
                parameters[42].Value = model.shiji_chuzu_jianyeshu;
                parameters[43].Value = model.kegong_chuzu_jianyeshu;
                parameters[44].Value = model.is_qiye_kuaiji_zhunze;
                parameters[45].Value = model.qiye_kuaiji_zhunze_suishi;
                parameters[46].Value = model.shenhe_zhuangtai;
                parameters[47].Value = model.shenhe_jujue_shuoming;
                parameters[48].Value = model.shenhe_ren;
                parameters[49].Value = model.shenhe_shijian;
                parameters[50].Value = model.fabu_shijian_kaishi;
                parameters[51].Value = model.fabu_shijian_jiezhi;
                parameters[52].Value = model.tianbao_shijian;
                parameters[53].Value = model.baobiao_mingcheng;
                parameters[54].Value = model.bbid;
                parameters[55].Value = model.tianbiao_ren;
                parameters[56].Value = model.tianbiao_ren_dianhua;
                parameters[57].Value = model.has_zanting;
                parameters[58].Value = model.zanting_shuoming;
                parameters[59].Value = model.yyjdid;
                parameters[60].Value = model.yywltid;
                parameters[61].Value = model.bb_riqi;

                lissql.Add(strSql.ToString());
                liscmd.Add(CommandType.Text);
                lispa.Add(parameters);
                #endregion
            }
            if (true)
            {
                #region baobiao_zhuangtai
                StringBuilder strSql = new StringBuilder();
                strSql.Append("update baobiao_zhuangtai set ");
                strSql.Append("zt_tianbao=@zt_tianbao,");
                strSql.Append("dt_tianbao=@dt_tianbao,");
                strSql.Append("yyjdid=@yyjdid");
                strSql.Append(" where bbid=@bbid and jdid=@jdid");
                MySqlParameter[] parameters = {
                    new MySqlParameter("@bbid", MySqlDbType.Int64,20),
                    new MySqlParameter("@jdid", MySqlDbType.Int32,11),
                    new MySqlParameter("@zt_tianbao", MySqlDbType.Int32,11),
                    new MySqlParameter("@dt_tianbao", MySqlDbType.DateTime),
                    new MySqlParameter("@yyjdid", MySqlDbType.Int32,11)};
                parameters[0].Value = modelbbzt.bbid;
                parameters[1].Value = modelbbzt.jdid;
                parameters[2].Value = modelbbzt.zt_tianbao;
                parameters[3].Value = modelbbzt.dt_tianbao;
                parameters[4].Value = modelbbzt.yyjdid;

                lissql.Add(strSql.ToString());
                liscmd.Add(CommandType.Text);
                lispa.Add(parameters);
                #endregion
            }

            int res = sqlhelper.ExecuteNonQueryWithTransaction(lissql, liscmd, lispa);
            return res;
        }

        /// <summary>
        /// 新增一条月报数据
        /// </summary>
        /// <param name="model">月报数据</param>
        /// <param name="modelbbzt">报表状态数据</param>
        /// <returns></returns>
        public int Add_yuebao(yuebao model, baobiao_zhuangtai modelbbzt)
        {
            List<string> lissql = new List<string>();
            List<CommandType> liscmd = new List<CommandType>();
            List<MySqlParameter[]> lispa = new List<MySqlParameter[]>();

            if (true)
            {
                #region yuebao
                StringBuilder strSql = new StringBuilder();
                strSql.Append("insert into yuebao(");
                strSql.Append("id,jdid,jiedai_renshu_jingnei,jiedai_renshu_jingwai,keyuan_qingkuang_json,pingjun_zhusu_tianshu,dachuang_fangjia,shuangbiao_fangjia,taofang_fangjia,wuzhangai_fangjia,pingjun_fangjia,fangjian_shouyi,kegong_chuzu_fangshu,kegong_chuzu_jianyeshu,shiji_chuzu_jianyeshu,yingye_shouru,kefang_shouru,canyin_shouru,qita_shouru,zhigong_renshu,dazhuan_zhigong_renshu,benke_zhigong_renshu,shuoshi_zhigong_renshu,boshi_zhigong_renshu,nanxing_zhigong_renshu,nvxing_zhigong_renshu,xianshang_yuding_shu,xianxia_yuding_shu,tongjituan_zaijian_json,tongjituan_nijian_json,shenhe_zhuangtai,shenhe_jujue_shuoming,shenhe_ren,shenhe_shijian,fabu_shijian_kaishi,fabu_shijian_jiezhi,tianbao_shijian,baobiao_mingcheng,bbid,tianbiao_ren,tianbiao_ren_dianhua,has_zanting,zanting_shuoming,yyjdid,yywltid,bb_riqi)");
                strSql.Append(" values (");
                strSql.Append("@id,@jdid,@jiedai_renshu_jingnei,@jiedai_renshu_jingwai,@keyuan_qingkuang_json,@pingjun_zhusu_tianshu,@dachuang_fangjia,@shuangbiao_fangjia,@taofang_fangjia,@wuzhangai_fangjia,@pingjun_fangjia,@fangjian_shouyi,@kegong_chuzu_fangshu,@kegong_chuzu_jianyeshu,@shiji_chuzu_jianyeshu,@yingye_shouru,@kefang_shouru,@canyin_shouru,@qita_shouru,@zhigong_renshu,@dazhuan_zhigong_renshu,@benke_zhigong_renshu,@shuoshi_zhigong_renshu,@boshi_zhigong_renshu,@nanxing_zhigong_renshu,@nvxing_zhigong_renshu,@xianshang_yuding_shu,@xianxia_yuding_shu,@tongjituan_zaijian_json,@tongjituan_nijian_json,@shenhe_zhuangtai,@shenhe_jujue_shuoming,@shenhe_ren,@shenhe_shijian,@fabu_shijian_kaishi,@fabu_shijian_jiezhi,@tianbao_shijian,@baobiao_mingcheng,@bbid,@tianbiao_ren,@tianbiao_ren_dianhua,@has_zanting,@zanting_shuoming,@yyjdid,@yywltid,@bb_riqi)");
                MySqlParameter[] parameters = {
                    new MySqlParameter("@id", MySqlDbType.Int64,20),
                    new MySqlParameter("@jdid", MySqlDbType.Int32,11),
                    new MySqlParameter("@jiedai_renshu_jingnei", MySqlDbType.Int32,11),
                    new MySqlParameter("@jiedai_renshu_jingwai", MySqlDbType.Int32,11),
                    new MySqlParameter("@keyuan_qingkuang_json", MySqlDbType.Text),
                    new MySqlParameter("@pingjun_zhusu_tianshu", MySqlDbType.Decimal,10),
                    new MySqlParameter("@dachuang_fangjia", MySqlDbType.Decimal,10),
                    new MySqlParameter("@shuangbiao_fangjia", MySqlDbType.Decimal,10),
                    new MySqlParameter("@taofang_fangjia", MySqlDbType.Decimal,10),
                    new MySqlParameter("@wuzhangai_fangjia", MySqlDbType.Decimal,10),
                    new MySqlParameter("@pingjun_fangjia", MySqlDbType.Decimal,10),
                    new MySqlParameter("@fangjian_shouyi", MySqlDbType.Decimal,10),
                    new MySqlParameter("@kegong_chuzu_fangshu", MySqlDbType.Int32,11),
                    new MySqlParameter("@kegong_chuzu_jianyeshu", MySqlDbType.Int32,11),
                    new MySqlParameter("@shiji_chuzu_jianyeshu", MySqlDbType.Int32,11),
                    new MySqlParameter("@yingye_shouru", MySqlDbType.Decimal,10),
                    new MySqlParameter("@kefang_shouru", MySqlDbType.Decimal,10),
                    new MySqlParameter("@canyin_shouru", MySqlDbType.Decimal,10),
                    new MySqlParameter("@qita_shouru", MySqlDbType.Decimal,10),
                    new MySqlParameter("@zhigong_renshu", MySqlDbType.Int32,11),
                    new MySqlParameter("@dazhuan_zhigong_renshu", MySqlDbType.Int32,11),
                    new MySqlParameter("@benke_zhigong_renshu", MySqlDbType.Int32,11),
                    new MySqlParameter("@shuoshi_zhigong_renshu", MySqlDbType.Int32,11),
                    new MySqlParameter("@boshi_zhigong_renshu", MySqlDbType.Int32,11),
                    new MySqlParameter("@nanxing_zhigong_renshu", MySqlDbType.Int32,11),
                    new MySqlParameter("@nvxing_zhigong_renshu", MySqlDbType.Int32,11),
                    new MySqlParameter("@xianshang_yuding_shu", MySqlDbType.Int32,11),
                    new MySqlParameter("@xianxia_yuding_shu", MySqlDbType.Int32,11),
                    new MySqlParameter("@tongjituan_zaijian_json", MySqlDbType.Text),
                    new MySqlParameter("@tongjituan_nijian_json", MySqlDbType.Text),
                    new MySqlParameter("@shenhe_zhuangtai", MySqlDbType.Int32,11),
                    new MySqlParameter("@shenhe_jujue_shuoming", MySqlDbType.Text),
                    new MySqlParameter("@shenhe_ren", MySqlDbType.VarChar,10),
                    new MySqlParameter("@shenhe_shijian", MySqlDbType.DateTime),
                    new MySqlParameter("@fabu_shijian_kaishi", MySqlDbType.DateTime),
                    new MySqlParameter("@fabu_shijian_jiezhi", MySqlDbType.DateTime),
                    new MySqlParameter("@tianbao_shijian", MySqlDbType.DateTime),
                    new MySqlParameter("@baobiao_mingcheng", MySqlDbType.VarChar,20),
                    new MySqlParameter("@bbid", MySqlDbType.Int64,20),
                    new MySqlParameter("@tianbiao_ren", MySqlDbType.VarChar,10),
                    new MySqlParameter("@tianbiao_ren_dianhua", MySqlDbType.VarChar,20),
                    new MySqlParameter("@has_zanting", MySqlDbType.Bit),
                    new MySqlParameter("@zanting_shuoming", MySqlDbType.Text),
                    new MySqlParameter("@yyjdid", MySqlDbType.Int32,11),
                    new MySqlParameter("@yywltid", MySqlDbType.Int32,11),
                    new MySqlParameter("@bb_riqi", MySqlDbType.Date)};
                parameters[0].Value = model.id;
                parameters[1].Value = model.jdid;
                parameters[2].Value = model.jiedai_renshu_jingnei;
                parameters[3].Value = model.jiedai_renshu_jingwai;
                parameters[4].Value = model.keyuan_qingkuang_json;
                parameters[5].Value = model.pingjun_zhusu_tianshu;
                parameters[6].Value = model.dachuang_fangjia;
                parameters[7].Value = model.shuangbiao_fangjia;
                parameters[8].Value = model.taofang_fangjia;
                parameters[9].Value = model.wuzhangai_fangjia;
                parameters[10].Value = model.pingjun_fangjia;
                parameters[11].Value = model.fangjian_shouyi;
                parameters[12].Value = model.kegong_chuzu_fangshu;
                parameters[13].Value = model.kegong_chuzu_jianyeshu;
                parameters[14].Value = model.shiji_chuzu_jianyeshu;
                parameters[15].Value = model.yingye_shouru;
                parameters[16].Value = model.kefang_shouru;
                parameters[17].Value = model.canyin_shouru;
                parameters[18].Value = model.qita_shouru;
                parameters[19].Value = model.zhigong_renshu;
                parameters[20].Value = model.dazhuan_zhigong_renshu;
                parameters[21].Value = model.benke_zhigong_renshu;
                parameters[22].Value = model.shuoshi_zhigong_renshu;
                parameters[23].Value = model.boshi_zhigong_renshu;
                parameters[24].Value = model.nanxing_zhigong_renshu;
                parameters[25].Value = model.nvxing_zhigong_renshu;
                parameters[26].Value = model.xianshang_yuding_shu;
                parameters[27].Value = model.xianxia_yuding_shu;
                parameters[28].Value = model.tongjituan_zaijian_json;
                parameters[29].Value = model.tongjituan_nijian_json;
                parameters[30].Value = model.shenhe_zhuangtai;
                parameters[31].Value = model.shenhe_jujue_shuoming;
                parameters[32].Value = model.shenhe_ren;
                parameters[33].Value = model.shenhe_shijian;
                parameters[34].Value = model.fabu_shijian_kaishi;
                parameters[35].Value = model.fabu_shijian_jiezhi;
                parameters[36].Value = model.tianbao_shijian;
                parameters[37].Value = model.baobiao_mingcheng;
                parameters[38].Value = model.bbid;
                parameters[39].Value = model.tianbiao_ren;
                parameters[40].Value = model.tianbiao_ren_dianhua;
                parameters[41].Value = model.has_zanting;
                parameters[42].Value = model.zanting_shuoming;
                parameters[43].Value = model.yyjdid;
                parameters[44].Value = model.yywltid;
                parameters[45].Value = model.bb_riqi;


                lissql.Add(strSql.ToString());
                liscmd.Add(CommandType.Text);
                lispa.Add(parameters);
                #endregion
            }
            if (true)
            {
                #region baobiao_zhuangtai
                StringBuilder strSql = new StringBuilder();
                strSql.Append("update baobiao_zhuangtai set ");
                strSql.Append("zt_tianbao=@zt_tianbao,");
                strSql.Append("dt_tianbao=@dt_tianbao,");
                strSql.Append("yyjdid=@yyjdid");
                strSql.Append(" where bbid=@bbid and jdid=@jdid");
                MySqlParameter[] parameters = {
                    new MySqlParameter("@bbid", MySqlDbType.Int64,20),
                    new MySqlParameter("@jdid", MySqlDbType.Int32,11),
                    new MySqlParameter("@zt_tianbao", MySqlDbType.Int32,11),
                    new MySqlParameter("@dt_tianbao", MySqlDbType.DateTime),
                    new MySqlParameter("@yyjdid", MySqlDbType.Int32,11)};
                parameters[0].Value = modelbbzt.bbid;
                parameters[1].Value = modelbbzt.jdid;
                parameters[2].Value = modelbbzt.zt_tianbao;
                parameters[3].Value = modelbbzt.dt_tianbao;
                parameters[4].Value = modelbbzt.yyjdid;

                lissql.Add(strSql.ToString());
                liscmd.Add(CommandType.Text);
                lispa.Add(parameters);
                #endregion
            }

            int res = sqlhelper.ExecuteNonQueryWithTransaction(lissql, liscmd, lispa);
            return res;
        }

        /// <summary>
        /// 修改用户酒店账号状态
        /// </summary>
        /// <param name="yhjdid">用户酒店id</param>
        /// <param name="zt">状态</param>
        /// <returns></returns>
        public int Modify_yonghu_jiudian_zt(int yhjdid, int zt)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("update yonghu_jiudian set ");
            strSql.Append("zhuangtai=@zhuangtai");
            strSql.Append(" where id=@id ");
            MySqlParameter[] parameters = {
                    new MySqlParameter("@zhuangtai", MySqlDbType.Int32,11),
                    new MySqlParameter("@id", MySqlDbType.Int32,11)};
            parameters[0].Value =zt;
            parameters[1].Value = yhjdid;

            int res = sqlhelper.ExecuteNonQuery(strSql.ToString(), CommandType.Text, parameters);
            return res;

        }

        /// <summary>
        /// 添加一条酒店用户数据
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public int Add_yonghu_jiudian(yonghu_jiudian model)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("insert into yonghu_jiudian(");
            strSql.Append("id,zhanghao,zhuangtai,jdid_json,leixing,xingming,guid_jdyh,mother_id)");
            strSql.Append(" values (");
            strSql.Append("@id,@zhanghao,@zhuangtai,@jdid_json,@leixing,@xingming,@guid_jdyh,@mother_id)");
            MySqlParameter[] parameters = {
                    new MySqlParameter("@id", MySqlDbType.Int32,11),
                    new MySqlParameter("@zhanghao", MySqlDbType.VarChar,20),
                    new MySqlParameter("@zhuangtai", MySqlDbType.Int32,11),
                    new MySqlParameter("@jdid_json", MySqlDbType.VarChar,1000),
                    new MySqlParameter("@leixing", MySqlDbType.Int32,11),
                    new MySqlParameter("@xingming", MySqlDbType.VarChar,10),
                    new MySqlParameter("@guid_jdyh", MySqlDbType.VarChar,100),
                    new MySqlParameter("@mother_id", MySqlDbType.Int32,11)};
            parameters[0].Value = model.id;
            parameters[1].Value = model.zhanghao;
            parameters[2].Value = model.zhuangtai;
            parameters[3].Value = model.jdid_json;
            parameters[4].Value = model.leixing;
            parameters[5].Value = model.xingming;
            parameters[6].Value = model.guid_jdyh;
            parameters[7].Value = model.mother_id;

            int res = sqlhelper.ExecuteNonQuery(strSql.ToString(), CommandType.Text, parameters);
            return res;
        }

        /// <summary>
        /// 修改用户酒店账号基本信息
        /// 姓名 账号 酒店权限
        /// </summary>
        /// <param name="yhjdid">用户酒店id</param>
        /// <param name="zt">状态</param>
        /// <returns></returns>
        public int Modify_yonghu_jiudian_info(yonghu_jiudian model)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("update yonghu_jiudian set ");
            strSql.Append("zhanghao=@zhanghao,");
            strSql.Append("jdid_json=@jdid_json,");
            strSql.Append("xingming=@xingming");
            strSql.Append(" where id=@id ");
            MySqlParameter[] parameters = {
                    new MySqlParameter("@zhanghao", MySqlDbType.VarChar,20),
                    new MySqlParameter("@jdid_json", MySqlDbType.VarChar,1000),
                    new MySqlParameter("@xingming", MySqlDbType.VarChar,10),
                    new MySqlParameter("@id", MySqlDbType.Int32,11)};
            parameters[0].Value = model.zhanghao;
            parameters[1].Value = model.jdid_json;
            parameters[2].Value = model.xingming;
            parameters[3].Value = model.id;

            int res = sqlhelper.ExecuteNonQuery(strSql.ToString(), CommandType.Text, parameters);
            return res;

        }

        /// <summary>
        /// 根据酒店编号获取酒店的报表统计数据 
        /// 不包含酒店名称
        /// </summary>
        /// <param name="lisjdid">酒店编号</param>
        /// <returns></returns>
        public List<DTO_JDTongJi> Get_DTO_JDTongJi(List<int> lisjdid)
        {
            List<DTO_JDTongJi> lisres = new List<DTO_JDTongJi>();
            if (lisjdid == null || lisjdid.Count <= 0)
            {
                return lisres;
            }
            string jdidstr = string.Join(",", lisjdid);
            //未填报            
            string sql = string.Format("SELECT jdid, COUNT(*) AS num FROM baobiao_zhuangtai WHERE zt_tianbao=0 AND jdid IN ({0}) GROUP BY jdid",jdidstr);
            DataTable dt = sqlhelper.GetDataTable(sql, CommandType.Text, null);
            List<DTO_JDTongJi> liswtb = Self_ToJDTongJi(dt);

            //已填报
            sql = string.Format("SELECT jdid, COUNT(*) AS num FROM baobiao_zhuangtai WHERE zt_tianbao=1 AND jdid IN ({0}) GROUP BY jdid", jdidstr);
            dt = sqlhelper.GetDataTable(sql, CommandType.Text, null);
            List<DTO_JDTongJi> lisytb = Self_ToJDTongJi(dt);

            //已退回
            sql = string.Format("SELECT jdid, COUNT(*) AS num FROM baobiao_zhuangtai WHERE zt_shenhe=2 AND jdid IN ({0}) GROUP BY jdid", jdidstr);
            dt = sqlhelper.GetDataTable(sql, CommandType.Text, null);
            List<DTO_JDTongJi> lisyth = Self_ToJDTongJi(dt);

            //整合数据到一起
            foreach (int jdid in lisjdid)
            {
                DTO_JDTongJi model_wtb = liswtb.Where(kkm => kkm.jdid == jdid).FirstOrDefault();
                DTO_JDTongJi model_ytb = lisytb.Where(kkm => kkm.jdid == jdid).FirstOrDefault();
                DTO_JDTongJi model_yth = lisyth.Where(kkm => kkm.jdid == jdid).FirstOrDefault();

                DTO_JDTongJi model = new DTO_JDTongJi();
                model.jdid = jdid;
                model.n_weitijiao = model_wtb == null ? 0 : model_wtb.n_weitijiao;
                model.n_yitijiao = model_ytb == null ? 0 : model_ytb.n_yitijiao;
                model.n_yituihui = model_yth == null ? 0 : model_yth.n_yituihui;

                lisres.Add(model);
            }
            return lisres;
            
        }

        /// <summary>
        /// 根据条件获取jiudian的条数
        /// </summary>
        /// <param name="strWhere">条件</param>
        /// <returns></returns>
        public int Get_JiuDianCount(string strWhere)
        {
            string sql = string.Format("SELECT COUNT(*) FROM jiudian "); ;
            if (!string.IsNullOrEmpty(strWhere))
            {
                sql += " where " + strWhere;
            }
            object obj = sqlhelper.ExecuteScalar(sql, CommandType.Text, null);
            if (obj == null)
                return 0;
            int count = 0;
            if (!int.TryParse(obj.ToString(), out count))
            {
                return 0;
            }
            return count;
        }

        /// <summary>
        /// 修改报表的状态
        /// </summary>
        /// <param name="bblx">类型 1月报 2年报</param>
        /// <param name="bbid">报表ID，不同类型的报表的ID</param>
        /// <param name="jdid">酒店id</param>
        /// <param name="zt">审核状态 0未审核 1审核通过 2审核拒绝</param>
        /// <param name="beizhu">备注，被拒绝时候的说明</param>
        /// <param name="yywltid">文旅厅用户id，审核人</param>
        /// <returns></returns>
        public int ModifyBBZhuangTai(int bblx, long bbid, int jdid, int zt,string beizhu,int yywltid)
        {
            
            List<string> lissql = new List<string>();
            List<CommandType> liscmd = new List<CommandType>();
            List<MySqlParameter[]> lispa = new List<MySqlParameter[]>();
            string sql = "";
            string dtNow = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
            if (bblx == 1)
            {
                #region 月报
                sql = string.Format("UPDATE yuebao SET shenhe_zhuangtai={0},shenhe_jujue_shuoming='{1}',shenhe_shijian='{2}',yywltid={3} WHERE bbid={4} AND jdid={5}", zt, beizhu, dtNow, yywltid, bbid, jdid);

                lissql.Add(sql);
                liscmd.Add(CommandType.Text);
                lispa.Add(new MySqlParameter[] { });

                #endregion
            }
            else if (bblx == 2)
            {
                sql = string.Format("UPDATE nianbao SET shenhe_zhuangtai={0},shenhe_jujue_shuoming='{1}',shenhe_shijian='{2}',yywltid={3} WHERE bbid={4} AND jdid={5}", zt, beizhu, dtNow, yywltid, bbid, jdid);

                lissql.Add(sql);
                liscmd.Add(CommandType.Text);
                lispa.Add(new MySqlParameter[] { });
            }
            //报表状态表
            sql =string.Format("UPDATE baobiao_zhuangtai SET zt_shenhe={0},dt_shenhe='{1}',yywltid={2} WHERE bbid={3} AND jdid={4}",zt,dtNow,yywltid,bbid,jdid);
            lissql.Add(sql);
            liscmd.Add(CommandType.Text);
            lispa.Add(new MySqlParameter[] { });

            int res = sqlhelper.ExecuteNonQueryWithTransaction(lissql, liscmd, lispa);
            return res;
        }

        /// <summary>
        /// 修改用户文旅厅账号状态
        /// </summary>
        /// <param name="yhwltid">用户文旅厅id</param>
        /// <param name="zt">状态</param>
        /// <returns></returns>
        public int Modify_yonghu_wenlvting_zt(int yhwltid, int zt)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("update yonghu_wenlvting set ");
            strSql.Append("zhuangtai=@zhuangtai");
            strSql.Append(" where id=@id ");
            MySqlParameter[] parameters = {
                    new MySqlParameter("@zhuangtai", MySqlDbType.Int32,11),
                    new MySqlParameter("@id", MySqlDbType.Int32,11)};
            parameters[0].Value = zt;
            parameters[1].Value = yhwltid;

            int res = sqlhelper.ExecuteNonQuery(strSql.ToString(), CommandType.Text, parameters);
            return res;

        }

        /// <summary>
        /// 添加一条文旅厅用户数据
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public int Add_yonghu_wenlvting(yonghu_wenlvting model)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("insert into yonghu_wenlvting(");
            strSql.Append("id,zhanghao,zhuangtai,leixing,aid_json,xingming,quanxian)");
            strSql.Append(" values (");
            strSql.Append("@id,@zhanghao,@zhuangtai,@leixing,@aid_json,@xingming,@quanxian)");
            MySqlParameter[] parameters = {
                    new MySqlParameter("@id", MySqlDbType.Int32,11),
                    new MySqlParameter("@zhanghao", MySqlDbType.VarChar,20),
                    new MySqlParameter("@zhuangtai", MySqlDbType.Int32,11),
                    new MySqlParameter("@leixing", MySqlDbType.Int32,11),
                    new MySqlParameter("@aid_json", MySqlDbType.VarChar,1000),
                    new MySqlParameter("@xingming", MySqlDbType.VarChar,10),
                    new MySqlParameter("@quanxian", MySqlDbType.Int32,11)};
            parameters[0].Value = model.id;
            parameters[1].Value = model.zhanghao;
            parameters[2].Value = model.zhuangtai;
            parameters[3].Value = model.leixing;
            parameters[4].Value = model.aid_json;
            parameters[5].Value = model.xingming;
            parameters[6].Value = model.quanxian;

            int res = sqlhelper.ExecuteNonQuery(strSql.ToString(), CommandType.Text, parameters);
            return res;
        }

        /// <summary>
        /// 修改文旅厅用户信息 
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public int Modify_yonghu_wenlvting_info(yonghu_wenlvting model)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("update yonghu_wenlvting set ");
            strSql.Append("zhanghao=@zhanghao,");
            strSql.Append("leixing=@leixing,");
            strSql.Append("aid_json=@aid_json,");
            strSql.Append("xingming=@xingming,");
            strSql.Append("quanxian=@quanxian");
            strSql.Append(" where id=@id ");
            MySqlParameter[] parameters = {
                    new MySqlParameter("@zhanghao", MySqlDbType.VarChar,20),
                    new MySqlParameter("@leixing", MySqlDbType.Int32,11),
                    new MySqlParameter("@aid_json", MySqlDbType.VarChar,1000),
                    new MySqlParameter("@xingming", MySqlDbType.VarChar,10),
                    new MySqlParameter("@quanxian", MySqlDbType.Int32,11),
                    new MySqlParameter("@id", MySqlDbType.Int32,11)};
            parameters[0].Value = model.zhanghao;
            parameters[1].Value = model.leixing;
            parameters[2].Value = model.aid_json;
            parameters[3].Value = model.xingming;
            parameters[4].Value = model.quanxian;
            parameters[5].Value = model.id;

            int res = sqlhelper.ExecuteNonQuery(strSql.ToString(), CommandType.Text, parameters);
            return res;
        }

        /// <summary>
        /// 根据条件获取baobiao_fabu的条数
        /// </summary>
        /// <param name="strWhere">条件</param>
        /// <returns></returns>
        public int Get_BBFaBuCount(string strWhere)
        {
            string sql = string.Format("SELECT COUNT(*) FROM baobiao_fabu "); ;
            if (!string.IsNullOrEmpty(strWhere))
            {
                sql += " where " + strWhere;
            }
            object obj = sqlhelper.ExecuteScalar(sql, CommandType.Text, null);
            if (obj == null)
                return 0;
            int count = 0;
            if (!int.TryParse(obj.ToString(), out count))
            {
                return 0;
            }
            return count;
        }

        /// <summary>
        /// 添加一条报表发布数据
        /// </summary>
        /// <param name="modelfb">报表发布</param>
        /// <param name="lisjdid">酒店id</param>
        /// <returns></returns>
        public int Add_baobiao_fabu(baobiao_fabu modelfb, List<int> lisjdid)
        {
            List<string> lissql = new List<string>();
            List<CommandType> liscmd = new List<CommandType>();
            List<MySqlParameter[]> lispa = new List<MySqlParameter[]>();
            if (true)
            {
                #region 报表发布
                StringBuilder strSql = new StringBuilder();
                strSql.Append("insert into baobiao_fabu(");
                strSql.Append("id,bb_name,leixing,bb_riqi,is_duanxin,tianbao_kaishi,tianbao_jieshu,fabu_ren,fabu_shijian,isdel,yywltid)");
                strSql.Append(" values (");
                strSql.Append("@id,@bb_name,@leixing,@bb_riqi,@is_duanxin,@tianbao_kaishi,@tianbao_jieshu,@fabu_ren,@fabu_shijian,@isdel,@yywltid)");
                MySqlParameter[] parameters = {
                    new MySqlParameter("@id", MySqlDbType.Int64,20),
                    new MySqlParameter("@bb_name", MySqlDbType.VarChar,100),
                    new MySqlParameter("@leixing", MySqlDbType.Int32,11),
                    new MySqlParameter("@bb_riqi", MySqlDbType.DateTime),
                    new MySqlParameter("@is_duanxin", MySqlDbType.Bit),
                    new MySqlParameter("@tianbao_kaishi", MySqlDbType.DateTime),
                    new MySqlParameter("@tianbao_jieshu", MySqlDbType.DateTime),
                    new MySqlParameter("@fabu_ren", MySqlDbType.VarChar,10),
                    new MySqlParameter("@fabu_shijian", MySqlDbType.DateTime),
                    new MySqlParameter("@isdel", MySqlDbType.Bit),
                    new MySqlParameter("@yywltid", MySqlDbType.Int32,11)};
                parameters[0].Value = modelfb.id;
                parameters[1].Value = modelfb.bb_name;
                parameters[2].Value = modelfb.leixing;
                parameters[3].Value = modelfb.bb_riqi;
                parameters[4].Value = modelfb.is_duanxin;
                parameters[5].Value = modelfb.tianbao_kaishi;
                parameters[6].Value = modelfb.tianbao_jieshu;
                parameters[7].Value = modelfb.fabu_ren;
                parameters[8].Value = modelfb.fabu_shijian;
                parameters[9].Value = modelfb.isdel;
                parameters[10].Value = modelfb.yywltid;

                lissql.Add(strSql.ToString());
                liscmd.Add(CommandType.Text);
                lispa.Add(parameters);
                #endregion
            }
            if (true)
            {
                #region 报表状态
                StringBuilder strSql = new StringBuilder();
                strSql.Append("insert into baobiao_zhuangtai(");
                strSql.Append("leixing,bbid,jdid,zt_duanxin,zt_shenhe,zt_tianbao,dt_duanxin,dt_shenhe,dt_tianbao,need_duanxin,bb_riqi,isdel,yyjdid,yywltid,tianbao_kaishi,tianbao_jieshu)");
                strSql.Append(" values ");
                string dt2000str = "2000-01-01";
                foreach (int jdid in lisjdid)
                {
                    strSql.AppendFormat("({0},{1},{2},{3},{4},{5},'{6}','{7}','{8}',{9},'{10}',{11},{12},{13},'{14}','{15}')",modelfb.leixing,modelfb.id,jdid,0,0,0,dt2000str,dt2000str,dt2000str,modelfb.is_duanxin,modelfb.bb_riqi.ToString("yyyy-MM-dd"),false,-1,modelfb.yywltid,modelfb.tianbao_kaishi.ToString("yyyy-MM-dd"),modelfb.tianbao_jieshu.ToString("yyyy-MM-dd"));
                    strSql.Append(",");
                }

                lissql.Add(strSql.ToString().TrimEnd(','));
                liscmd.Add(CommandType.Text);
                lispa.Add(new MySqlParameter[] { });
                #endregion
            }

            int res = sqlhelper.ExecuteNonQueryWithTransaction(lissql, liscmd, lispa);
            return res;

        }





        #region 自定义方法区

        /// <summary>
        /// 将查询出来的酒店统计table转换成list
        /// </summary>
        /// <param name="dt"></param>
        /// <returns></returns>
        private List<DTO_JDTongJi> Self_ToJDTongJi(DataTable dt)
        {
            List<DTO_JDTongJi> lisres = new List<DTO_JDTongJi>();
            if (dt != null && dt.Rows.Count > 0)
            {
                foreach (DataRow row in dt.Rows)
                {
                    DTO_JDTongJi model = new DTO_JDTongJi();
                    model.jdid = int.Parse(row[0].ToString());
                    model.n_tmp = int.Parse(row[1].ToString());
                    lisres.Add(model);
                }
            }
            return lisres;
        }

        #endregion






    }
}